package com.example.app03.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.app03.bean.Artical;
import com.example.app03.service.IArticalService;



@RequestMapping("/artical")
@RestController
public class ArticalController {

	@Autowired
	private IArticalService articalService;
	
	@RequestMapping("/save")
	public String save(Artical artical) {
		articalService.save(artical);
		return "保存成功";
		
	}
	
	@GetMapping("findAll")
	public List<Artical> findAll(){
		return articalService.findAll();
	}
	@GetMapping("findById")
	public Artical findById(long id) {
		return articalService.findById(id);
		
	}
	
	@GetMapping("deleteById")
	public String deleteById(long id) {
		articalService.deleteById(id);
		return "删除成功";
		
	}
}
